import React from "react";

const Graph = (props) => {
    
    const handleClick = () => {
        // 调用API，往编辑器中插入一个数字
        props.editor.insertText(
            "```mermaid\n" + 
            "graph LR\n" + 
            "A-->B\n" + 
            "```\n\n" + 
            "<p>请参考<a href=\"https://github.com/mermaid-js/mermaid\" target=\"_blank\">mermaid</a>。</p>"
        );
    }

    return (
        <span
        className="button button-type-counter"
        title="流程图"
        onClick={handleClick}
        >
        <i className="fa fa-long-arrow-right" />
        </span>
    );
}

Graph.align = 'left';
Graph.pluginName = 'graph';

export default Graph;